<?php  
      
    class categoryModel extends Model{  
      
        function categoryModel(){  
            parent::Model();  
        }  
		
		function getCategory($id){  
      
        $data = array();  
      
        $where = array('cat_id' => $id);  
      
        $query = $this->db->getwhere('categories',$where,1);  
      
        if ($query-> num_rows() > 0){  
            $data = $query->row_array();  
        }  
      
        $query->free_result();  
        return $data;  
		}  
		
		function getAllCategories(){  
			$data = array();  
			$query = $this->db->get('categories');  
		  
			if ($query->num_rows() > 0){  
				foreach($query->result_array() as $row){  
				$data[] = $row;  
				}  
			}  
			$query->free_result();  
			return $data;  
		}  
    }  
?>